<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<%@taglib uri="/struts-tags" prefix="s" %>
<%@ page import="org.apache.commons.lang.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%
//产生随机数，和密码一起生成MD5
request.getSession().setAttribute("md5RandomKey",RandomStringUtils.randomAlphabetic(10));
%>
<!DOCTYPE HTML >
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>登陆</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	 <meta charset="UTF-8">
    <link href="UI/css/admin_login.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="UI/js/libs/md5.js"></script>
	<script type="text/javascript" src="UI/admins/js/libs/jquery.js"></script>
	<script type="text/javascript">
	function encryptionPassword(){	
		var myName="<%=session.getAttribute("md5RandomKey")%>"; 
	     var hash = MD5(document.getElementById('pwd').value+"${md5RandomKey}");  
	     document.getElementById('pwd').value = hash;  
	    } 
	</script>
  </head>
  
  <body>
  	<s:if test="message!=null">
		<script type="text/javascript">
			var msg = "${message}";
			alert(msg);
		</script>
	</s:if>
    <div class="admin_login_wrap">
    <h1>后台管理</h1>
    <div class="adming_login_border">

        <div class="admin_input">
            <s:form action="adminLogin" method="post" onsubmit="encryptionPassword()">
                <ul class="admin_items">
                    <li>
                        <label for="user">用户名：</label>
                        <s:textfield name="account" id="user"  size="40" class="admin_input_style"></s:textfield>
                    </li>
                    <li>

                        <label for="pwd">密码：</label>
                        <s:textfield type="password" name="pwd" id="pwd" size="40" class="admin_input_style"></s:textfield>
                    </li>
                    <li>

                        <label for="who">角色：</label>
                        <s:select id="role" name="juese"  list="#{1:'商家',2:'管理员'}">
						</s:select>
                    </li>
                    <li>
                        <input type="submit" tabindex="3" value="提交" class="btn btn-primary" />
                    </li>
                </ul>
            </s:form>

        </div>
    </div>
</div>

  </body>
</html>
